//
//  HospitalViewController.m
//  必争医疗
//
//  Created by 8号球 on 14-11-19.
//  Copyright (c) 2014年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "HospitalViewController.h"
#import "Top1ViewController.h"
#import "Top2ViewController.h"
#import "Top3ViewController.h"
#import "Top4ViewController.h"
#import "Top5ViewController.h"
#import "MidViewController.h"

@interface HospitalViewController ()

@end

@implementation HospitalViewController
- (void)dealloc
{
    [_backScroll release];
    [super dealloc];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self.view setBackgroundColor:[UIColor whiteColor]];
    [self.navigationController.navigationBar setHidden:YES];
    self.backScroll = [[[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, 375, 667 - 49)]autorelease];
    _backScroll.contentSize = CGSizeMake(0, 780);
    _backScroll.backgroundColor = [UIColor brownColor];
    [self creatTopView];
    [self creatButton];
    [self creatMidScroll];
    [self creatView];
    [self.view addSubview:_backScroll];
}
- (void)creatTopView
{
    UIScrollView *topScroll = [[[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, 375, 150)]autorelease];
    topScroll.backgroundColor = [UIColor darkGrayColor];
    topScroll.contentSize = CGSizeMake(375 * 4, 0);
    [_backScroll addSubview:topScroll];
}
- (void)creatButton
{
    UIButton *top1 = [UIButton buttonWithType:UIButtonTypeCustom];
    top1.Frame = CGRectMake(0, 150, 375 / 2, 160);
    top1.backgroundColor = [UIColor redColor];
    [top1 addTarget:self action:@selector(Top1:) forControlEvents:UIControlEventTouchUpInside];
    UIButton *top2 = [UIButton buttonWithType:UIButtonTypeCustom];
    top2.frame = CGRectMake(375 / 2, 150, 375 / 2, 160);
    top2.backgroundColor = [UIColor yellowColor];
    [top2 addTarget:self action:@selector(Top2:) forControlEvents:UIControlEventTouchUpInside];
    UIButton *top3 = [UIButton buttonWithType:UIButtonTypeCustom];
    top3.frame = CGRectMake(0, 310, 375 / 3, 120);
    top3.backgroundColor = [UIColor greenColor];
    [top3 addTarget:self action:@selector(Top3:) forControlEvents:UIControlEventTouchUpInside];
    UIButton *top4 = [UIButton buttonWithType:UIButtonTypeCustom];
    top4.frame = CGRectMake(375 / 3, 310, 375 / 3, 120);
    top4.backgroundColor = [UIColor blueColor];
    [top4 addTarget:self action:@selector(Top4:) forControlEvents:UIControlEventTouchUpInside];
    UIButton *top5 = [UIButton buttonWithType:UIButtonTypeCustom];
    top5.frame = CGRectMake(375 / 3 * 2, 310, 375 / 3, 120);
    top5.backgroundColor = [UIColor purpleColor];
    [top5 addTarget:self action:@selector(Top5:) forControlEvents:UIControlEventTouchUpInside];
    [_backScroll addSubview:top1];
    [_backScroll addSubview:top2];
    [_backScroll addSubview:top3];
    [_backScroll addSubview:top4];
    [_backScroll addSubview:top5];
}
- (void)Top1 :(id)sender
{
    Top1ViewController *T1 = [[[Top1ViewController alloc]init]autorelease];
    [self.navigationController pushViewController:T1 animated:YES];
}
- (void)Top2 :(id)sender
{
    Top2ViewController *T2 = [[[Top2ViewController alloc]init]autorelease];
    [self.navigationController pushViewController:T2 animated:YES];
}
- (void)Top3 :(id)sender
{
    Top3ViewController *T3 = [[[Top3ViewController alloc]init]autorelease];
    [self.navigationController pushViewController:T3 animated:YES];
}
- (void)Top4 :(id)sender
{
    Top4ViewController *T4 = [[[Top4ViewController alloc]init]autorelease];
    [self.navigationController pushViewController:T4 animated:YES];
}
- (void)Top5 :(id)sender
{
    Top5ViewController *T5 = [[[Top5ViewController alloc]init]autorelease];
    [self.navigationController pushViewController:T5 animated:YES];
}
- (void)creatMidScroll
{
    UIScrollView *midScroll = [[[UIScrollView alloc]initWithFrame:CGRectMake(0, 440, 375, 190)]autorelease];
    midScroll.contentSize = CGSizeMake(160 * 3 + 40, 0);
    UIButton *mid1 = [UIButton buttonWithType:UIButtonTypeCustom];
    mid1.frame = CGRectMake(10, 10, 160, 80);
    mid1.backgroundColor = [UIColor grayColor];
    [mid1 addTarget:self action:@selector(Mid:) forControlEvents:UIControlEventTouchUpInside];
    UIButton *mid2 = [UIButton buttonWithType:UIButtonTypeCustom];
    mid2.frame = CGRectMake(180, 10, 160, 80);
    mid2.backgroundColor = [UIColor grayColor];
    [mid2 addTarget:self action:@selector(Mid:) forControlEvents:UIControlEventTouchUpInside];
    UIButton *mid3 = [UIButton buttonWithType:UIButtonTypeCustom];
    mid3.frame = CGRectMake(350, 10, 160, 80);
    mid3.backgroundColor = [UIColor grayColor];
    [mid3 addTarget:self action:@selector(Mid:) forControlEvents:UIControlEventTouchUpInside];
    UIButton *mid4 = [UIButton buttonWithType:UIButtonTypeCustom];
    mid4.frame = CGRectMake(10, 100, 160, 80);
    mid4.backgroundColor = [UIColor grayColor];
    [mid4 addTarget:self action:@selector(Mid:) forControlEvents:UIControlEventTouchUpInside];
    UIButton *mid5 = [UIButton buttonWithType:UIButtonTypeCustom];
    mid5.frame = CGRectMake(180, 100, 160, 80);
    mid5.backgroundColor = [UIColor grayColor];
    [mid5 addTarget:self action:@selector(Mid:) forControlEvents:UIControlEventTouchUpInside];
    UIButton *mid6 = [UIButton buttonWithType:UIButtonTypeCustom];
    mid6.frame = CGRectMake(350, 100, 160, 80);
    mid6.backgroundColor = [UIColor grayColor];
    [mid6 addTarget:self action:@selector(Mid:) forControlEvents:UIControlEventTouchUpInside];
    [midScroll addSubview:mid1];
    [midScroll addSubview:mid2];
    [midScroll addSubview:mid3];
    [midScroll addSubview:mid4];
    [midScroll addSubview:mid5];
    [midScroll addSubview:mid6];
    [_backScroll addSubview:midScroll];
}
- (void)Mid :(id)sender
{
    self.navigationController.navigationBar.translucent = NO;
    UIButton *b = sender;
    NSString *str = b.currentTitle;
    MidViewController *M = [[[MidViewController alloc]init]autorelease];
    [self.navigationController pushViewController:M animated:YES];
    [M creatView:@"http://www.chunyuyisheng.com/api/v5/topic_promotion/1/wap"];    
    [M creatButtonItem:str];
}
- (void)creatView
{
    UIView *backView = [[[UIView alloc]initWithFrame:CGRectMake(0, 640, 375, 175)]autorelease];
    UILabel *backViewLable = [[[UILabel alloc]initWithFrame:CGRectMake(0, 0, 375, 25)]autorelease];
    backViewLable.text = @"必争好医生";
    UIScrollView *lastScroll = [[[UIScrollView alloc]initWithFrame:CGRectMake(0, 25, 375, 150)]autorelease];
    lastScroll.contentSize = CGSizeMake(475, 0);
    lastScroll.backgroundColor = [UIColor darkGrayColor];
    [backView addSubview:backViewLable];
    [backView addSubview:lastScroll];
    [_backScroll addSubview:backView];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
